﻿using CNotebook.Sales;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CNotebook;
namespace NotebookS2
{
    public partial class BRW_PICKLIST : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        public BRW_PICKLIST()
        {
            InitializeComponent();
        }

        public string ConnectionString { get; set; }
        public void PrintPreview()
        {
            if (!gridControl1.IsPrintingAvailable)
            {
                MessageBox.Show("The 'DevExpress.XtraPrinting' Library is not found", "Error");
                return;
            }
            // Opens the Preview window. 
            gridControl1.ShowPrintPreview();
        }
        private void BRW_PICKLIST_Load(object sender, EventArgs e)
        {
            dtFROM.EditValue = System.DateTime.Now;
            dtTO.EditValue = System.DateTime.Now;

        }

        private void btnPreview_Click(object sender, EventArgs e)
        {
            OrderManager oManager = new OrderManager();

            oManager.ConnectionString = this.ConnectionString;
            oManager.Open();
            DataTable dt = oManager.GetPostedOrderForPicking((DateTime)dtFROM.EditValue, (DateTime)dtTO.EditValue);
            oManager.Close();

            gridControl1.DataSource = dt;
            gridControl1.Refresh();

        }
    }
}
